package TestClasses;

import java.util.ArrayList;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import ModelLayer.*;
import DBLayer.*;

public class DBSupplierTest {
	
	DBSupplier dbs = new DBSupplier();

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testGetAllSuppliers() {
		ArrayList<Supplier> sup = dbs.getAllSuppliers(false);
	    System.out.println(sup.size());
	}

	@Test
	public void testFindSupplier() {
		Supplier sup = dbs.findSupplier(1);
		System.out.println(sup.getName());
	}

	@Test
	public void testSearchSupplierName() {
		Supplier sup = dbs.searchSupplierName("Ringridderne");
		System.out.println(sup.getName() + " " + sup.getAddress());
	}

	@Test
	public void testSearchSupId() {
		Supplier sup = dbs.searchSupId(1);
		System.out.println(sup.getName() + " " + sup.getAddress());
	}

/*	@Test
	public void testInsertSupplier() throws Exception {
		Supplier supObj = new Supplier(7, "Lanzas Guns", "Onsild Byvej 4", "DK-6000", "Kolding", "Denmark", "77665555", "lanza@gunshops.com");
		dbs.insertSupplier(supObj);
	}*/

/*	@Test
	public void testUpdateSupplier() {
		Supplier supObj = new Supplier(4, "Lanzas Gunshop", "Onsild Byvej 4", "DK-6000", "Kolding", "Denmark", "77665555", "lanza@gunshops.com");
		dbs.updateSupplier(supObj);
	}*/

	@Test
	public void testDeleteSupplier() {
		dbs.deleteSupplier(4);
		ArrayList<Supplier> sups = dbs.getAllSuppliers(false);
		System.out.println(sups.size());
	}

}
